package net.sf.nlp.segment;

import java.util.ArrayList;
import java.util.List;

public class SegmentResult 
{
	private String text;
	
	private List<SegNode> nodes = new ArrayList<SegNode>();
	
	public SegmentResult(String text)
	{
		this.text = text;
	}
	
	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public void addSegNodes(List<SegNode> path)
	{
		path.remove(0);
		path.remove(path.size() - 1);
		
		this.nodes.addAll(path);
	}
	
	public String toString()
	{
		return toString(true);
	}
	
	public String toString(boolean isNeedPos)
	{
		StringBuffer sb = new StringBuffer();
		
		for (SegNode node : nodes)
			sb.append(node.toString(isNeedPos)).append(" ");
		
		return sb.toString().trim();
	}
}
